package hr.fer.zpr.nmbp.project3.model;

import hr.fer.zpr.nmbp.project3.model.util.DateUtil;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class Dijagnoza {
    
    private int sifra = 0;   //primarni ključ, umjetno generiran
    private Date datum;
    private String opis;
    
    private Karton karton;
    private List<Bolest> bolesti = new ArrayList<Bolest>();

    public Dijagnoza() {
    }
    
    public Dijagnoza(int sifra) {
        this.sifra = sifra;
    }
    
    public Dijagnoza(int sifra, Karton karton, Date datum, String opis, List<Bolest> bolesti) {
       this.sifra = sifra;
       this.karton = karton;
       this.datum = datum;
       this.opis = opis;
       this.bolesti = bolesti;
    }
    
    public int getSifra() {
        return sifra;
    }

    public void setSifra(int sifra) {
        this.sifra = sifra;
    }
    
    public List<Bolest> getBolesti() {
        return bolesti;
    }

    public void setBolesti(List<Bolest> bolesti) {
        this.bolesti = bolesti;
    }

    public Date getDatum() {
        return datum;
    }

    public void setDatum(Date datum) {
        this.datum = datum;
    }

    public Karton getKarton() {
        return karton;
    }

    public void setKarton(Karton karton) {
        this.karton = karton;
    }

    public String getOpis() {
        return opis;
    }

    public void setOpis(String opis) {
        this.opis = opis;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Dijagnoza other = (Dijagnoza) obj;
        if ((this.sifra == 0) ? (other.sifra != 0) : !(this.sifra == other.sifra)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 29 * hash + this.sifra;
        return hash;
    }
    
    @Override
    public String toString() {
    	return DateUtil.formatDate(this.datum) +"  "+ karton.getPacijent().toString();
    }    
}
